//vue.config.js
const path = require('path')
const resolve = (dir) => path.join(__dirname, dir)
module.exports = {
  publicPath: './',//基本路径
  assetsDir: 'static',//放置生成的静态资源 (js、css、img、fonts) 的目录
  productionSourceMap: false,//生产环境是否生成 sourceMap 文件
  devServer: {
    proxy: {
        '/api': {
            target: 'http://localhost:8080',
            changeOrigin: true,
            // pathRewrite: {
            //     ['^/api']: '/api'
            // }
        }
      }
  },
  chainWebpack: (config) => {
  　  //配置别名
    config.resolve.alias
      .set('@', resolve('src'))
      .set('assets', resolve('src/assets'))
      .set('components', resolve('src/components'))
      .set('utils', resolve('src/utils'));
  },
  configureWebpack: (config) => {
    config.module.rules.push({
      test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
      use: [{
        loader: 'url-loader', // 解决ivew组件 忽略前缀i的问题
        options: {
          prefix: false
        }
      }]
    })
  },
}
